package com.emser.unc.server.domain;

import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import com.emser.unc.serializable.LocationDTO;

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
public class Device {
	@PrimaryKey
    @Persistent
	private String serialDevice;
    @Persistent
	private Double latitude;
    @Persistent
	private Double longitude;
    @Persistent
	private String userA;
    @Persistent
	private String firstName;
    @Persistent
	private String lastName;
	
	public Double getLatitude() {
		return latitude;
	}
	public void setLatitude(Double latitude) {
		this.latitude = latitude;
	}
	public Double getLongitude() {
		return longitude;
	}
	public void setLongitude(Double longitude) {
		this.longitude = longitude;
	}
	public void setSerialDevice(String serialDevice) {
		this.serialDevice = serialDevice;
	}
	public String getSerialDevice() {
		return serialDevice;
	}
	public void setUserA(String userA) {
		this.userA = userA;
	}
	public String getUserA() {
		return userA;
	}	
	
	public static LocationDTO toDTO(Device device) {
	    if (device == null) {
	      return null;
	    }
	    LocationDTO deviceDTO = new LocationDTO();
	    deviceDTO.setSerialDevice(device.getSerialDevice());
	    deviceDTO.setFirstName(device.getFirstName());
	    deviceDTO.setLastName(device.getLastName());
	    deviceDTO.setLatitude(device.getLatitude());
	    deviceDTO.setLongitude(device.getLongitude());
	    return deviceDTO;
	}
	
	
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	
	public String getFirstName() {
		return firstName;
	}
	
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	
	public String getLastName() {
		return lastName;
	}
	

}
